home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / HAMRADIO / KS_CW.ZIP / CW.DOC < prev    next >
Text File  |  1988-10-22  |  14KB  |  442 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  AAAA MMMMoooorrrrsssseeee CCCCooooddddeeee SSSSeeeennnnddddiiiinnnngggg aaaannnndddd RRRReeeecccceeeeiiiivvvviiiinnnngggg PPPPrrrrooooggggrrrraaaammmm ffffoooorrrr tttthhhheeee IIIIBBBBMMMM----PPPPCCCC
  8.  
  9.                     _K_e_v_i_n _S_c_h_m_i_d_t, _W_9_C_F
  10.    _T_h_i_s _i_s _t_h_e _d_o_c_u_m_e_n_t_a_t_i_o_n _f_o_r _C_W._C, _a _p_r_o_g_r_a_m _t_o _s_e_n_d
  11.         _a_n_d _r_e_c_e_i_v_e _i_n_t_e_r_n_a_t_i_o_n_a_l _m_o_r_s_e _c_o_d_e _v_i_a _t_h_e
  12.                     _I_B_M-_P_C _s_e_r_i_a_l _p_o_r_t.
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23. _C_o_p_y_r_i_g_h_t _1_9_8_8 _b_y _K_e_v_i_n _S_c_h_m_i_d_t. _T_h_i_s _d_o_c_u_m_e_n_t _m_a_y _b_e _r_e_p_r_o_d_u_c_e_d
  24. _f_o_r _a_n_y _n_o_n_c_o_m_m_e_r_c_i_a_l _p_u_r_p_o_s_e _a_s _l_o_n_g _a_s _c_r_e_d_i_t _i_s _g_i_v_e_n _t_o _t_h_e _a_u_t_h_o_r.
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.                       October 22, 1988
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                            - 2 -
  68.  
  69.  
  70. _1.  _I_n_t_r_o_d_u_c_t_i_o_n
  71.  
  72.      This documentation is for CW.C a morse code sending and
  73. receiving  program written in TURBO-C 1.0 (with bug patches)
  74. for the IBM-PC. You should receive the  C  source  with  any
  75. distribution of this documentation.
  76.  
  77.      DISCLAIMER: CW.C bypasses both  the  BIOS  and  DOS  to
  78. reprogram the serial port hardware and the timer/sound chip.
  79. The author takes no responsibility  for  what  running  this
  80. code  may  do  to  your system. It is provided AS IS with NO
  81. WARRANTEE whatsoever. Run it at your own risk.
  82.  
  83.      The distribution should contain the files:
  84.  
  85.      1.   CW.DOC -- this file
  86.  
  87.      2.   CW.C -- the source program
  88.  
  89.      3.   CW.INI -- an example initialization file
  90.  
  91.      4.   CW.EXE -- (optional) a  compiled  version  of  the
  92.           code. If not supplied or you want to know what you
  93.           are using, compile cw.c using TURBO-C.  My command
  94.           line to do this is:
  95.           tcc -Lc:urbocnclude cw.c
  96.           where you need to change  -L  and  -I  options  to
  97.           correspond  to  the  location  of your library and
  98.           include files.
  99.  
  100. _2.  _S_e_t_u_p _a_n_d _O_p_e_r_a_t_i_o_n
  101.  
  102.      CW functions as two separate programs one  for  sending
  103. morse  from  the  keyboard and the other for receiving morse
  104. and displaying it on the screen. The two programs  are  very
  105. loosely  coupled.  Morse  is sent by toggling the request to
  106. send line of the RS-232 serial port.  Mark is +12V and space
  107. is  -12V. Similarly morse characters are received by looking
  108. at the clear to send line of the RS-232 port.
  109.  
  110.      To get started, put CW.EXE in a  subdirectory  and  put
  111. CW.INI  in  the  same subdirectory. Edit the file CW.INI and
  112. put in any commands that you want  executed  at  startup  in
  113. this file. The example file is:
  114. sound off
  115. sound 40
  116. serial 3f8 4
  117. b1  cq cq cq de w9cf w9cf w9cf k
  118. b2  r tnx for call = rst
  119. b3  = qth new york city ny = name kevin = hw?
  120. b4  de w9cf k
  121.  
  122.  
  123.  
  124.                       October 22, 1988
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                            - 3 -
  131.  
  132.  
  133. These commands first turn off  the  speaker  which  normally
  134. beeps  whenever  an input mark is detected. The frequency of
  135. the beep is set to 40HZ. This will be the frequency  of  the
  136. beep if the sound is turned back on. Next the serial port is
  137. set to com1.  Com1 is the default so this line  is  unneces-
  138. sary.  For  com2 you would use the command serial 2f8 3. See
  139. the serial command below for more information. There are ten
  140. send  buffers. The first 4 are set in the next 4 lines. Each
  141. of these ends with a space so that a space is the last char-
  142. acter  sent. However, this space does not show above. Modify
  143. the buffers to hold whatever you like.
  144.  
  145.      To test the code, you can loop back the sender  to  the
  146. receiver.  Do this by shorting the clear to send line of the
  147. RS-232 port to the request to send  line.  These  should  be
  148. pins  4 and 5 of a 25 pin connector. Start up CW. The top of
  149. the screen holds help information. The middle of the  screen
  150. is  the  receive  display  and  the  bottom  portion  is the
  151. transmit display. The last line is used as  a  command  line
  152. and will be described later.
  153.  
  154.      Type something at the keyboard. It should be  displayed
  155. in  the  transmit  region. Now hit the f9 function key. This
  156. will tell the computer to send  the  text  in  the  transmit
  157. queue out the serial port.  Since this is looped back to the
  158. receiver, it should be displayed in the  middle  portion  of
  159. the  screen. If you want to hear the code on the speaker hit
  160. the f1 key. Alternatively, you can leave the sound off  line
  161. out of cw.ini or replace it with sound on. Note, the speaker
  162. is connected to the receive section. Transmitted  characters
  163. will  not  sound the speaker unless it is looped back to the
  164. receiver.
  165.  
  166. _3.  _H_e_l_p _S_c_r_e_e_n _a_n_d _f_u_n_c_t_i_o_n _k_e_y_s
  167.  
  168.      The help screen displays the following information:
  169.  
  170.      1.   auto or man  --  indicating  whether  the  receive
  171.           speed  is  set  by  the  program  by analyzing the
  172.           incoming morse, or by the operator. Manual mode is
  173.           probably  necessary if you want to hook this up to
  174.           a radio.
  175.  
  176.      2.   dot -- this displays the current  speed  in  words
  177.           per  minute  of  what the code thinks are incoming
  178.           dots.
  179.  
  180.      3.   dash -- this displays the current speed  in  words
  181.           per  minute  of  what the code thinks are incoming
  182.           dashs.
  183.  
  184.  
  185.  
  186.  
  187.                       October 22, 1988
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                            - 4 -
  194.  
  195.  
  196.      4.   el sp -- this displays the current speed in  words
  197.           per minute of the spaces between dots and dashes.
  198.  
  199.      5.   lt sp -- this displays the current speed in  words
  200.           per minute of the spaces between letters.
  201.  
  202.      6.   rcv -- this displays the approximate receive speed
  203.           in words per minute if the program is set to auto.
  204.           In manual  mode,  it  displays  the  manually  set
  205.           receive speed.
  206.  
  207.      7.   The other items are a quick reference to what  the
  208.           function  keys  do,  and  how  to get command line
  209.           help.
  210.  
  211.      The 10 function keys are set up as follows:
  212.  
  213.      f1.  -- toggles the speaker on and off.
  214.  
  215.      f2.  -- toggles the receive  speed  from  automatic  to
  216.           manual.
  217.  
  218.      f3.  -- in manual mode decreases the receive speed.
  219.  
  220.      f4.  -- in manual mode increases the receive speed.
  221.  
  222.      f5.  -- increases the transmit speed.
  223.  
  224.      f6.  -- decreases the transmit speed.
  225.  
  226.      f7.  -- set transmit speed to current receive speed.
  227.  
  228.      f8.  -- enter a command in command mode.
  229.  
  230.      f9.  -- toggle from send mode to  hold  mode.  In  hold
  231.           mode, text is entered in the transmit queue but is
  232.           not sent until send mode is toggled.
  233.  
  234.      f10. -- exit from CW program.
  235.  
  236.      Shift-f?.
  237.           -- i.e. hold down  the  shift  and  function  key,
  238.           where  ?  is 1 through 10 causes the corresponding
  239.           numbered buffer to be  appended  to  the  transmit
  240.           queue.
  241.  
  242.      CTRL-f?.
  243.           -- i.e. hold down the control key and the function
  244.           key. This erases the contents of the corresponding
  245.           numbered buffer and prompts for new text.   It  is
  246.           usually  a  good  idea to end text with a space. A
  247.  
  248.  
  249.  
  250.                       October 22, 1988
  251.  
  252.  
  253.  
  254.  
  255.  
  256.                            - 5 -
  257.  
  258.  
  259.           carriage return (enter key) terminates the text.
  260.  
  261.      ALT-f?.
  262.           -- i.e. hold down the alt  key  and  the  function
  263.           key.   This  displays  the  current  text  in  the
  264.           corresponding numbered buffer.
  265.  
  266. _4.  _C_o_m_m_a_n_d_s
  267.  
  268.      The following commands are allowed in command mode. Any
  269. command listed here may also be used in the startup file.
  270.  
  271.           read filename -- reads in the  filename  specified
  272.           and sends it.
  273.  
  274.           sound on -- turns on the speaker.
  275.  
  276.           sound off -- turns off the speaker.
  277.  
  278.           sound nnnn -- where nnnn is  a  number,  sets  the
  279.           sound frequency to nnnn.
  280.  
  281.           receive  automatic  --  set   receive   speed   to
  282.           automatic.
  283.  
  284.           receive manual -- set receive speed to manual.
  285.  
  286.           receive nn -- where nn is a number,  sets  receive
  287.           speed to nn words per minute.
  288.  
  289.           serial hhhh h -- sets the serial port. hhhh is the
  290.           serial  port  base  address  in  hex  and h is the
  291.           hardware interrupt vector used by the serial port.
  292.           Initially,  this  is  set to 3f8 4 which is normal
  293.           for com1. Com2 uses 2f8 3. For other serial  ports
  294.           you  will have to fill in the correct values.  You
  295.           should also check the  interrupt  handler  in  the
  296.           source code to make sure it does what you want.
  297.  
  298.           stretch nnnn -- where nnnn is  a  number,  reduces
  299.           marks    and    increases   spaces   by   nnnn*840
  300.           nanoseconds. This can be helpful to compensate for
  301.           pulse stretching in audio filters.
  302.  
  303.           bn text -- where n is a number from 1 to 10, fills
  304.           corresponding buffer with text where text is what-
  305.           ever is to be sent.
  306.  
  307.           transmit on --  tells  program  to  send  text  in
  308.           transmit queue (see f9 above).
  309.  
  310.  
  311.  
  312.  
  313.                       October 22, 1988
  314.  
  315.  
  316.  
  317.  
  318.  
  319.                            - 6 -
  320.  
  321.  
  322.           transmit off -- tells  program  to  hold  text  in
  323.           transmit queue (see f9 above).
  324.  
  325. _5.  _T_h_e_o_r_y _o_f _O_p_e_r_a_t_i_o_n
  326.  
  327.      Only a very brief theory of operation will be given.
  328.  
  329.      The program can be divided into three parts. The  first
  330. part is an interrupt handler for the serial port. The serial
  331. port is set to interrupt on change of the modem  status.  In
  332. particular,  this  happens  when  the  clear to send line is
  333. changed. The interrupt handler simply records the status  of
  334. the  clear to send line in queue.mark and the time since the
  335. clear to send line last changed in queue.mstime  and  incre-
  336. ments  the  queue  pointer countin. The serial port stuff is
  337. fairly standard and I used the description given  by  of  R.
  338. Jourdain,  "Programmer's  Problem  Solver for the IBM PC,XT,
  339. and AT", (Prentice Hall, 1986,  NY)  although  he  gets  the
  340. interrupt  numbers  wrong.   The  method used for timing the
  341. marks and spaces is adapted from B. Sheppard, "High  Perfor-
  342. mance Software Analysis on the IBM PC", BYTE, January 1987.
  343.  
  344.      The second part of the code is a  replacement  for  the
  345. IRQ0  timer  interrupt.  I  change  the  timer  to interrupt
  346. SPEEDUP times faster than original. Every SPEEDUP interrupts
  347. the  old interrupt handler is called so that disk operations
  348. and the bios date should  be  unaffected.   The  replacement
  349. interrupt handler takes characters from a queue and keys the
  350. request to send line of the serial port. Note  if  you  only
  351. want to receive morse this replacement routine is not neces-
  352. sary  since  microsecond  receive  timing  accuracy  can  be
  353. obtained   without  changing  this  interrupt.  Just  change
  354. SPEEDUP to 1. Note SPEEDUP must be a power of 2.
  355.  
  356.      The last part of the code is the human interface, which
  357. looks  at  the  receive  queue and displays the result along
  358. with some statistics, and also fills the transmit queue.
  359.  
  360.      The code has been tested on my 6MHZ ibm  pc-at  running
  361. dos 3.1 with CGA and serial/parallel adaptor and on a zenith
  362. z-181 portable.  Any other  80  column  or  greater  display
  363. should work. Since the clock chip is reprogrammed and serial
  364. port interrupts are used, probably only hardware as well  as
  365. bios  level  clones of the IBM PC will run this code. If you
  366. are attempting to run this code on a particularly  slow  PC,
  367. you  may want to set SPEEDUP to 1 to start. After everything
  368. is working correctly, increase speedup to  get  the  desired
  369. set  of  transmit  speeds.  The possible transmit speeds are
  370. given by dot length = N*840ns*65536/(SPEEDUP) where N is  an
  371. integer,  ns  stands  for nanoseconds, and SPEEDUP must be a
  372. power of 2 for proper operation.
  373.  
  374.  
  375.  
  376.                       October 22, 1988
  377.  
  378.  
  379.  
  380.  
  381.  
  382.                            - 7 -
  383.  
  384.  
  385.      Most of the information in this section is contained in
  386. the  source  code  comments, which also give some additional
  387. information.
  388.  
  389. _6.  _C_o_n_c_l_u_s_i_o_n
  390.  
  391.      I originally wrote this code as a tool  to  help  teach
  392. morse.  By  hooking  a  code key to toggle the clear to send
  393. line, the student can see what she is sending and get a fair
  394. idea  if  her  spacing  is  correct. The sending portion was
  395. added when I needed a cw keyboard for my transmitter.
  396.  
  397.      I have connected the PC  to my receiver. It  is  fairly
  398. easy  to  receive strong signals using machine produced code
  399. like that from W1AW, but much more difficult  to  deal  with
  400. noisy signals and hand sending.
  401.  
  402.      I do not plan to work on this code in the future.  How-
  403. ever,  if  you  have  questions,  I  can  be contacted at my
  404. address listed in the call book.
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.                       October 22, 1988
  440.  
  441.  
  442.